{extend name="$base" /}
{block name="resources"}
<link href="ADMIN_CSS/express/freight_edit.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	.modal-body{
		padding: 5px;
		max-height:450px;
	}
	.checkbox-common{
		float: left;
    	margin-top: 5px;
	}
</style>
{/block}
{block name="main"}
<div class="space-10"></div>
<div class="set-style">
	<dl>
		<dt>满额包邮：</dt>
		<dd>
			<p>
				<input  type="checkbox"  id="manebaoyouResult" class="checkbox" {if condition="$info.is_open eq 1"}checked="checked"{/if}  
				/>
			</p>
		</dd>
	</dl>
	<dl>
		<dt>包邮所需订单金额：</dt>
		<dd>
			<div>
				<input id="full_mail_money" class="input-mini input-common harf" type="number" min="0.01" step="0.01" value="{$info.full_mail_money}" /><em class="unit">元</em>
				<span id="full_mail" class="help-inline ml15" style="display: none;color:red;">请输入包邮所需订单金额</span>
			</div>
			<p class="hint">请设定数字参数，全场包邮请填写0</p>
		</dd>
	</dl>
	<dl>
		<dt>设置不包邮地区：</dt>
		<dd>
			<div>
				<span class="js-region-info region-info">{$no_mail_province}</span>
				<a class="Js_select_city btn-common" style="line-height: 20px;display: inline-block;" data-flag="0" href="javascript:;">指定地区城市</a>
			</div>
		</dd>
	</dl>
	<dl>
		<dt></dt>
		<dd>
			<button class="btn-common btn-big" onclick="SavepointConfig();">保存</button>
		</dd>
	</dl>
</div>

<div class="modal fade hide" id="select-region" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h3>批量处理</h3>
			</div>
			<div class="modal-body">
				<div class="cont">
					<div class="selectSub dialog-areas">
						<ul class="js-regions">
							{foreach name="$address_list" item="area" key="k"}
							{if condition="$area.province_list_count"}
							<li>
								<div class="dcity clearfix">
									<!-- 大类 -->
									<div class="ecity gcity">
										<span class="group-label">
											<i class="checkbox-common"><input id="first_region_{$k}" data-first-index="{$k}" value="{foreach name="area.province_list" item="province"}{$province.province_id},{/foreach}" type="checkbox" /></i>
											<label for="first_region_{$k}" title="{$area.area_name}">{$area.area_name}</label>
										</span>
									</div>
									
									<!-- 省 -->
									<div class="province-list">
									
										{foreach name="area.province_list" item="province" key="second"}
										<div class="ecity">
											<span class="gareas">

												<i class="checkbox-common"><input data-second-parent-index="{$k}" data-province-id="{$province.province_id}" id="second_region_{$k}_{$province.province_id}" type="checkbox" data-province-name="{$province.province_name}" value="{$province.province_id}" /></i>
												<label for="second_region_{$k}_{$province.province_id}" title="{$province.province_name}">{$province.province_name}</label>
												<img class="drop-down" src="ADMIN_IMG/freight_city_drop_down.gif" data-level="province" />
												
												<!-- 市 -->
												<div class="citys" id="citys_{$province.province_id}">
													{foreach name="province.city_list" item="city" key="third"}
														<span class="areas">
															<i class="checkbox-common"><input data-third-parent-index="{$k}" data-province-id="{$province.province_id}" data-city-id="{$city.city_id}" value="{$city.city_id}" id="third_{$k}_{$city.city_id}" type="checkbox" /></i>
															<label for="third_{$k}_{$city.city_id}" title="{$city.city_name}">{$city.city_name}</label>
														</span>
													{/foreach}
												</div>
											</span>
										</div>
										{/foreach}
										
									</div>
								</div>
							</li>
							{/if}
							{/foreach}
						</ul>
					</div>
				</div>	
			</div>
			<div class="modal-footer">
				<button class="btn-common btn-big js-confirm">保存</button>
				<button class="btn-common-cancle btn-big" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>

{if condition="$info['no_mail_province_id_array'] !=''"}
<input type="hidden" id="hidden_province_id_array" value="{$info['no_mail_province_id_array']}" />
{else/}
<input type="hidden" id="hidden_province_id_array"/>
{/if}

{if condition="$info['no_mail_city_id_array'] !=''"}
<input type="hidden" id="hidden_city_id_array" value="{$info['no_mail_city_id_array']}" />
{else/}
<input type="hidden" id="hidden_city_id_array"/>
{/if}
{/block}
{block name="script"}
<script type="text/javascript" src="ADMIN_JS/selectNoMailArea.js"></script>
<script type="text/javascript">
function SavepointConfig(){
	setProvinceIdArray();
	setCityIdArray();
	var is_open = $("#manebaoyouResult").prop('checked')? 1 : 0 ;
	var full_mail_money = $("#full_mail_money").val();
	if(full_mail_money == ''){
		$("#full_mail").show();
		return false;
	}
	var no_mail_province_id_array = $("#hidden_province_id_array").val();
	var no_mail_city_id_array = $("#hidden_city_id_array").val();
	$.ajax({
		type:"post",
		url : "{:__URL('ADMIN_MAIN/promotion/fullshipping')}",
		data : {
			"is_open" : is_open,
			"full_mail_money" : full_mail_money,
			"no_mail_province_id_array" : no_mail_province_id_array, 
			"no_mail_city_id_array" : no_mail_city_id_array
		},
		success : function(data){
			if(data['code'] > 0){
				showMessage('success', data["message"]);
			}else{
				showMessage('error', data["message"]);
			}
		}
	});
}
</script>
{/block}